// ColonyScreenPresentationModel.cs
//
// Copyright (c) 2009 Mike Strobel
//
// This source code is subject to the terms of the Microsoft Reciprocal License (Ms-RL).
// For details, see <http://www.opensource.org/licenses/ms-rl.html>.
//
// All other rights reserved.

using System;
using System.Collections.Generic;
using System.Windows.Input;

using Supremacy.Economy;
using Supremacy.Universe;

namespace Supremacy.Client.Views
{
    public class ColonyScreenPresentationModel : PresentationModelBase
    {
        public ColonyScreenPresentationModel(IClientContext clientContext) : base(clientContext) {}

        #region Colony Property
        public event EventHandler SelectedColonyChanged;

        private Colony _selectedColony;

        private void OnSelectedColonyChanged()
        {
            var handler = this.SelectedColonyChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public Colony SelectedColony
        {
            get { return this._selectedColony; }
            set
            {
                this._selectedColony = value;
                this.OnSelectedColonyChanged();
            }
        }
        #endregion

        #region Colonies Property
        public event EventHandler ColoniesChanged;

        private IEnumerable<Colony> _colonies;

        private void OnColoniesChanged()
        {
            var handler = this.ColoniesChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public IEnumerable<Colony> Colonies
        {
            get { return _colonies; }
            set
            {
                if (Equals(_colonies, value))
                    return;
                _colonies = value;
                OnColoniesChanged();
            }
        }
        #endregion

        #region SelectedPlanetaryBuildProject Property
        private BuildProject _selectedPlanetaryBuildProject;

        public event EventHandler SelectedPlanetaryBuildProjectChanged;

        private void OnSelectedPlanetaryBuildProjectChanged()
        {
            var handler = this.SelectedPlanetaryBuildProjectChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public BuildProject SelectedPlanetaryBuildProject
        {
            get { return this._selectedPlanetaryBuildProject; }
            set
            {
                if (Equals(this._selectedPlanetaryBuildProject, value))
                    return;
                this._selectedPlanetaryBuildProject = value;
                OnSelectedPlanetaryBuildProjectChanged();
            }
        }
        #endregion

        #region SelectedShipyardBuildProject Property
        private BuildProject _selectedShipyardBuildProject;

        public event EventHandler SelectedShipyardBuildProjectChanged;

        private void OnSelectedShipyardBuildProjectChanged()
        {
            var handler = this.SelectedShipyardBuildProjectChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public BuildProject SelectedShipyardBuildProject
        {
            get { return _selectedShipyardBuildProject; }
            set
            {
                if (Equals(_selectedShipyardBuildProject, value))
                    return;
                _selectedShipyardBuildProject = value;
                OnSelectedShipyardBuildProjectChanged();
            }
        }
        #endregion

        #region PlanetaryBuildProjects Property
        private IEnumerable<BuildProject> _planetaryBuildProjects;

        public event EventHandler PlanetaryBuildProjectsChanged;

        private void OnPlanetaryBuildProjectsChanged()
        {
            var handler = this.PlanetaryBuildProjectsChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public IEnumerable<BuildProject> PlanetaryBuildProjects
        {
            get { return _planetaryBuildProjects; }
            set
            {
                if (Equals(_planetaryBuildProjects, value))
                    return;
                _planetaryBuildProjects = value;
                OnPlanetaryBuildProjectsChanged();
            }
        }
        #endregion

        #region ShipyardBuildProjects Property
        private IEnumerable<BuildProject> _shipyardBuildProjects;

        public event EventHandler ShipyardBuildProjectsChanged;

        private void OnShipyardBuildProjectsChanged()
        {
            var handler = this.ShipyardBuildProjectsChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public IEnumerable<BuildProject> ShipyardBuildProjects
        {
            get { return _shipyardBuildProjects; }
            set
            {
                if (Equals(_shipyardBuildProjects, value))
                    return;
                _shipyardBuildProjects = value;
                OnShipyardBuildProjectsChanged();
            }
        }
        #endregion

        #region AddToPlanetaryBuildQueue Command
        public event EventHandler AddToPlanetaryBuildQueueCommandChanged;

        private ICommand _addToPlanetaryBuildQueueCommand;

        private void OnAddToPlanetaryBuildQueueCommandChanged()
        {
            var handler = this.AddToPlanetaryBuildQueueCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand AddToPlanetaryBuildQueueCommand
        {
            get { return this._addToPlanetaryBuildQueueCommand; }
            set
            {
                if (Equals(this._addToPlanetaryBuildQueueCommand, value))
                    return;
                this._addToPlanetaryBuildQueueCommand = value;
                OnAddToPlanetaryBuildQueueCommandChanged();
            }
        }
        #endregion

        #region RemoveFromPlanetaryBuildQueue Command
        public event EventHandler RemoveFromPlanetaryBuildQueueCommandChanged;

        private ICommand _removeFromPlanetaryBuildQueueCommand;

        private void OnRemoveFromPlanetaryBuildQueueCommandChanged()
        {
            var handler = this.RemoveFromPlanetaryBuildQueueCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand RemoveFromPlanetaryBuildQueueCommand
        {
            get { return _removeFromPlanetaryBuildQueueCommand; }
            set
            {
                if (Equals(_removeFromPlanetaryBuildQueueCommand, value))
                    return;
                _removeFromPlanetaryBuildQueueCommand = value;
                OnRemoveFromPlanetaryBuildQueueCommandChanged();
            }
        }
        #endregion

        #region AddToShipyardBuildQueue Command
        public event EventHandler AddToShipyardBuildQueueCommandChanged;

        private ICommand _addToShipyardBuildQueueCommand;

        private void OnAddToShipyardBuildQueueCommandChanged()
        {
            var handler = this.AddToShipyardBuildQueueCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand AddToShipyardBuildQueueCommand
        {
            get { return this._addToShipyardBuildQueueCommand; }
            set
            {
                if (Equals(this._addToShipyardBuildQueueCommand, value))
                    return;
                this._addToShipyardBuildQueueCommand = value;
                OnAddToShipyardBuildQueueCommandChanged();
            }
        }
        #endregion

        #region RemoveFromShipyardBuildQueue Command
        public event EventHandler RemoveFromShipyardBuildQueueCommandChanged;

        private ICommand _removeFromShipyardBuildQueueCommand;

        private void OnRemoveFromShipyardBuildQueueCommandChanged()
        {
            var handler = this.RemoveFromShipyardBuildQueueCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand RemoveFromShipyardBuildQueueCommand
        {
            get { return _removeFromShipyardBuildQueueCommand; }
            set
            {
                if (Equals(_removeFromShipyardBuildQueueCommand, value))
                    return;
                _removeFromShipyardBuildQueueCommand = value;
                OnRemoveFromShipyardBuildQueueCommandChanged();
            }
        }
        #endregion

        #region CancelBuildProject Command
        public event EventHandler CancelBuildProjectCommandChanged;

        private ICommand _cancelBuildProjectCommand;

        private void OnCancelBuildProjectCommandChanged()
        {
            var handler = this.CancelBuildProjectCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand CancelBuildProjectCommand
        {
            get { return _cancelBuildProjectCommand; }
            set
            {
                if (Equals(_cancelBuildProjectCommand, value))
                    return;
                _cancelBuildProjectCommand = value;
                OnCancelBuildProjectCommandChanged();
            }
        }
        #endregion

        #region ActivateFacility Command
        private ICommand _activateFacilityCommand;

        public event EventHandler ActivateFacilityCommandChanged;

        private void OnActivateFacilityCommandChanged()
        {
            var handler = this.ActivateFacilityCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand ActivateFacilityCommand
        {
            get { return _activateFacilityCommand; }
            set
            {
                if (Equals(_activateFacilityCommand, value))
                    return;
                _activateFacilityCommand = value;
                OnActivateFacilityCommandChanged();
            }
        }
        #endregion

        #region DeactivateFacility Command
        private ICommand _deactivateFacilityCommand;

        public event EventHandler DeactivateFacilityCommandChanged;

        private void OnDeactivateFacilityCommandChanged()
        {
            var handler = this.DeactivateFacilityCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand DeactivateFacilityCommand
        {
            get { return _deactivateFacilityCommand; }
            set
            {
                if (Equals(_deactivateFacilityCommand, value))
                    return;
                _deactivateFacilityCommand = value;
                OnDeactivateFacilityCommandChanged();
            }
        }
        #endregion

        #region ScrapFacility Command
        private ICommand _scrapFacilityCommand;

        public event EventHandler ScrapFacilityCommandChanged;

        private void OnScrapFacilityCommandChanged()
        {
            var handler = this.ScrapFacilityCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand ScrapFacilityCommand
        {
            get { return _scrapFacilityCommand; }
            set
            {
                if (Equals(_scrapFacilityCommand, value))
                    return;
                _scrapFacilityCommand = value;
                OnScrapFacilityCommandChanged();
            }
        }
        #endregion

        #region UnscrapFacility Command
        private ICommand _unscrapFacilityCommand;

        public event EventHandler UnscrapFacilityCommandChanged;

        private void OnUnscrapFacilityCommandChanged()
        {
            var handler = this.UnscrapFacilityCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand UnscrapFacilityCommand
        {
            get { return _unscrapFacilityCommand; }
            set
            {
                if (Equals(_unscrapFacilityCommand, value))
                    return;
                _unscrapFacilityCommand = value;
                OnUnscrapFacilityCommandChanged();
            }
        }
        #endregion

        #region ToggleBuildingScrap Command
        private ICommand _toggleBuildingScrapCommand;

        public event EventHandler ToggleBuildingScrapCommandChanged;

        private void OnToggleBuildingScrapCommandChanged()
        {
            var handler = this.ToggleBuildingScrapCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand ToggleBuildingScrapCommand
        {
            get { return _toggleBuildingScrapCommand; }
            set
            {
                if (Equals(_toggleBuildingScrapCommand, value))
                    return;
                _toggleBuildingScrapCommand = value;
                OnToggleBuildingScrapCommandChanged();
            }
        }
        #endregion

        #region ToggleBuildingIsActive Command
        private ICommand _toggleBuildingIsActiveCommand;

        public event EventHandler ToggleBuildingIsActiveCommandChanged;

        private void OnToggleBuildingIsActiveCommandChanged()
        {
            var handler = this.ToggleBuildingIsActiveCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand ToggleBuildingIsActiveCommand
        {
            get { return _toggleBuildingIsActiveCommand; }
            set
            {
                if (Equals(_toggleBuildingIsActiveCommand, value))
                    return;
                _toggleBuildingIsActiveCommand = value;
                OnToggleBuildingIsActiveCommandChanged();
            }
        }
        #endregion

        #region ToggleShipyardBuildSlot Command
        private ICommand _toggleShipyardBuildSlotCommand;

        public event EventHandler ToggleShipyardBuildSlotCommandChanged;

        private void OnToggleShipyardBuildSlotCommandChanged()
        {
            var handler = this.ToggleShipyardBuildSlotCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand ToggleShipyardBuildSlotCommand
        {
            get { return _toggleShipyardBuildSlotCommand; }
            set
            {
                if (Equals(_toggleShipyardBuildSlotCommand, value))
                    return;
                _toggleShipyardBuildSlotCommand = value;
                OnToggleShipyardBuildSlotCommandChanged();
            }
        }
        #endregion

        #region SelectShipBuildProjectCommand Command
        private ICommand _selectShipBuildProjectCommand;

        public event EventHandler SelectShipBuildProjectCommandChanged;

        private void OnSelectShipBuildProjectCommandChanged()
        {
            var handler = this.SelectShipBuildProjectCommandChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        public ICommand SelectShipBuildProjectCommand
        {
            get { return _selectShipBuildProjectCommand; }
            set
            {
                if (Equals(_selectShipBuildProjectCommand, value))
                    return;
                _selectShipBuildProjectCommand = value;
                OnSelectShipBuildProjectCommandChanged();
            }
        }
        #endregion
    }
}